<template>
  <div>
    <el-tag>跟进记录</el-tag>
    <div v-for="item in dataList" style="font-size: 12px">
      <el-row v-if="item.trackStatus">
        <el-col :span="8">
          <span>跟进状态</span>
        </el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.track_status,item.trackStatus)}}</span></el-col>
      </el-row>
      <el-row v-if="item.nextTime">
        <el-col :span="8">
          <span>下次跟进时间</span>
        </el-col>
        <el-col :span="16"><span>{{item.nextTime}}</span></el-col>
      </el-row>
      <el-row v-if="item.keyItems">
        <el-col :span="8">
          <span>沟通重点</span>
        </el-col>
        <el-col :span="16"><span>{{item.keyItems}}</span></el-col>
      </el-row>
      <el-row v-if="item.level">
        <el-col :span="8">
          <span>意向等级</span>
        </el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.clues_level ,item.level)}}</span></el-col>
      </el-row>
      <el-row v-if="item.subject">
        <el-col :span="8">
          <span>意向学科</span>
        </el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.course_subject ,item.subject)}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <span>沟通内容</span>
        </el-col>
        <el-col :span="16"><span>{{item.record}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <span>操作人员</span>
        </el-col>
        <el-col :span="16"><span>{{item.operName}}</span></el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <span>操作时间</span>
        </el-col>
        <el-col :span="16"><span>{{parseTime(new Date(item.operTime),'{y}-{m}-{d}:{h}:{i}:{s}')}}</span></el-col>
      </el-row>
      <hr/>
    </div>
  </div>
</template>

<script>
  import {list} from "@/api/monitor/operlog";
  import {listTrackLog} from "../../../../api/crm/trackLog";

  export default {
    name: "track-list",
    dicts: ['sys_user_sex', 'clues_level', 'course_subject', 'clues_item', 'channel_type',
      'occupation', 'education', 'job', 'major', 'sys_user_sex', 'salary', 'clue_status',
      'track_status', 'communication_point', 'reasons_for_reporting',],
    props: {
      id: {
        type: [String, Number],
      },
      // search: {
      //   type: String,
      //   default: '商机',
      // },
    },
    data() {
      return {
        dataList: [],
        search: '商机',
      }
    },
    created() {
      this.getList();
    },
    methods: {
      // 查询线索跟踪记录
      getList() {
        // list({title: '商机跟进记录'}).then(resp => {
        //   this.dataList = this.parseData(resp.rows);
        // });
        listTrackLog({id: this.id, table: this.search}).then(resp => {
          this.dataList = resp.rows;
        })
      },
      // 初始化
      parseData(result) {
        let list = [];
        if (result && result.length > 0) {
          for (let item of result) {
            let operParam = JSON.parse(item.operParam);
            if (operParam.id == this.id) {
              item.operParam = operParam;
              list.push(item);
            }
          }
        }
        return list;
      }
    },
  }
</script>

<style scoped>

</style>
